package com.example.xianzhi.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.hutool.json.JSONUtil;
import com.example.xianzhi.dao.UserDao;
import com.example.xianzhi.dao.impl.UserDaoImpl;
import com.example.xianzhi.entity.TbUser;
import com.example.xianzhi.service.UserSercive;
import com.example.xianzhi.service.impl.UserSerciveImpl;
import org.apache.log4j.Logger;
import org.lanqiao.mvc.controller.BookController;
import org.lanqiao.mvc.entity.ModelAndView;
import org.lanqiao.mvc.entity.YockMvcAnnotation;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

//配置一级路径
@YockMvcAnnotation.Controller("/user")
public class UserController {
	

	private  UserSercive userSercive = new UserSerciveImpl();
	
	
	/*
	 * 进入控制层只有3种选择：
	 * 1>请求转发				@ResponseDispatch("请求转发的地址")     要求方法的返回值类型必须是ModelAndView
	 * 2>响应json数据			@ResponseBody						要求方法的返回值类型必须是String
	 * 3>其他（重定向、响应流...）	@ResponseVoid						要求方法的返回值类型必须是void
	 */

	@YockMvcAnnotation.RequestMapping("/usersele.do")	//配置二级路径
	@YockMvcAnnotation.ResponseDispatch("/WEB-INF/view/Consumer.jsp")
	public ModelAndView testXML1(
			HttpServletRequest request,
			HttpServletResponse response
	) throws Exception{
		ModelAndView model = new ModelAndView();

		String wx_nick = request.getParameter("user_wx_nick");
		String wx_address = request.getParameter("user_wx_address");
		String user_credit = request.getParameter("user_credit");

		int a= 0;

		if(user_credit!=null && !user_credit.equals("") ){
			a =Integer.parseInt(user_credit);
		}

		List<TbUser> listuserss = userSercive.selectuserss(wx_nick,wx_address,a);
		model.addObject("listuserss",listuserss);




		return model;
	}
	
	

		

	
	
	
}
